package com.demo.yarn.merge;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.PathFilter;

public class RegexAcceptFilter implements PathFilter{
    private final String regex ;

    public RegexAcceptFilter(String regex){
        this.regex = regex ;
    }

    //过滤 regex 格式的文件
    @Override
    public boolean accept(Path path) {
        boolean flag = path.toString().matches(regex);
        //符合得我就接受，不符合的就过滤，所以是非flag
        return flag;
    }


}
